package com.dave.gd.service.impl;

import java.sql.Timestamp;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dave.gd.service.ITeacherService;
import com.dave.gd.sysmgr.domain.entity.Teacher;
import com.dave.gd.sysmgr.domain.mapper.TeacherMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@Service
public class TeacherService implements ITeacherService {
    @Autowired
    private TeacherMapper teacherDao;
    
    @Override
    public int insert(Teacher t) {
        //Date date = new Date();
       // Timestamp ttmp =new Timestamp(date.getTime());
        return this.teacherDao.insert(t);
    }

    @Override
    public int delete(long id) {
        return this.teacherDao.deleteById(id);
    }

    @Override
    public int update(Teacher t) {
        return this.teacherDao.update(t);
    }

    @Override
    public Teacher get(long id) {
        return this.teacherDao.queryById(id);
    }

    @Override
    public Page<Teacher> queryPage(Integer pageNum, Integer pageSize, Teacher t) {
        PageHelper.startPage(pageNum, pageSize);
        Page<Teacher> pt = this.teacherDao.queryPage(t);
        
        return pt;
    }
    
}
